#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char const *argv[])
{
    // 构造方式 区间构造
    vector<int> v1 = {10,20,30,40};

    // 构造方式 拷贝构造
    vector<int> v2(v1);

    vector<int> v3(10,100);

    v3.swap(v2);

    v2.pop_back();
    // 设置容量大小
    // v_2.shrink_to_fit(); // 将容器的容量缩小到当前元素数量，释放多余的空间

    cout << v2.capacity() << endl;

    // 遍历数据 迭代器
    for (vector<int>::iterator it = v1.begin(); it != v1.end() ; it++)
    {
        cout << *it << endl;
    }
    cout << "------------------------------------------------------------" <<endl;
    for (vector<int>::iterator it = v2.begin(); it != v2.end() ; it++)
    {
        cout << *it << endl;
    }
    cout << "------------------------------------------------------------" <<endl;
    for (vector<int>::iterator it = v3.begin(); it != v3.end() ; it++)
    {
        cout << *it << endl;
    }

    
    return 0;
}
